home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX 6.5 Applications 1999 May
/
SGI IRIX 6.5 Applications 1999 May.iso
/
dist
/
cosmocreate.idb
/
usr
/
share
/
CosmoCreate
/
buttons
/
README.z
/
README
Wrap
Text File
|
1998-05-07
|
5KB
|
135 lines
How to Construct a Button File
------------------------------
1. What is it?
The button file is basically a special purpose Inventor
file, as indicated by its .jbm extention.
Among other things, it contains the color, textures,
lights, and geometry that compose the button scene.
In addition, it contains two very special nodes,
the CoTextGraph node, and the CoMultiButton node.
Together these nodes form the dynamic resizing button
structure, which means the file will reconfigure itself
to surround the text when loaded into a capable
editor/viewer/renderer.
Unfortunately, since the file is not pure Inventor, it can't
be viewed in any of the standard viewers (ivview, SceneViewer, etc.)
Instead, it must be viewed in Button Magic.
Below are some hints on how to create, test, and debug a button.
2. How do you create one?
Step 1. Model the geometry.
This involves using a tool to construct several
different sizes of a particular geometry, one for
each of several (12 or so) aspect ratios.
This can be done in any tool that can read (or at least write)
Inventor format. You can use Showcase to create a button like
Quad.jbm, for example, using the bevel tools.
CosmoWorlds may be used to create something like the arrow
buttons (LeftArrow.jbm and RightArrow.jbm), although you will
have to translate the VRML file back to Inventor
format before it can be used. It's also possible to create
a simple button with vi or your favorite text editor.
See the comments in the file ExampleButton for details.
You should build all button geometry centered at
the origin so that lighting will be consistent as the
button changes.
Step 2. Collect the geometry under a switch node.
The geometry must be sorted under a single Switch
node. If the geometry is more complex than a simple
primitive, group all geometry for a given button under
a Separator under this Switch.
The geometry should be sorted in order of increasing
aspect (width / height).
Step 3. Test it using a program such as gview.
The gview program (usr/demos/Inventor/gview) which
comes out of inventor_eoe.demo.progs is very useful
for doing this, since it allows fields of the nodes
to be changed.
Open the top level SoSwitch node and step the
whichChild field from 0 to the number of child
geometry nodes - 1.
As you do this, the geometry should expand horizontally
with each new value of whichChild.
Step 4. Once you're satisfied with the behavior, take a look at
the ExampleButton file. You will be replacing the Switch
node (and its children) in the ExampleButton file with the
toplevel Switch node (and its children) in the file you
just created.
Step 5. Once you're happy with the file, run Button Magic on it.
You can load the button directly by running:
/usr/lib/CosmoCreate/apps/buttonMagic -f myfile.jbm
Step 6. For ButtonMagic to see the file, it must end in .jbm
(as in Just a Button Magic file)
3. Hints on creating geometry.
A. Create all buttons with the center at the origin.
B. Creating geometry that grows slowly at first is a good start.
Here's a good set of aspects to construct
1 2 3 4 5 6 7 8 10 12 18 24 32 48 64 96
More is better, but this allows for a good range of sizes
and aspects.
After deciding the appropriate aspect of the button,
Button Magic "blends" between buttons by performing
a non-uniform scale on the chosen button. This can result
in undesirable artifacts (non-uniform bevels, for example).
As a result, you should focus your efforts on creating buttons
in the region of aspects that you use the most.
Typically, these will be 10 to 20 characters on
a button with aspects between 1:1 and 10:1.
C. Remove all material properties below the switch node.
This is required so that Button Magic can assign materials.
An exception to this rule is if you wish to create a button
with some kind of constant color trim (black trim, for example).
In general, it should be avoided.
D. Add an SoComplexity node at the top of the scene graph or as
the node just before the above Switch node. Setting
the value to 1.0 will result in the best looking buttons,
but will increase rendering time. (See Aluminum.jbm as an example)
E. To better show when Button Magic switches geometry,
temporary materials may be added to each of the children
under the switch node. (See ExampleButton)
4. Hints on lighting
A. Try not to use too many colored lights. This will limit
the range of materials that will look good on the button.
B. Point lights add visual complexity, but slow down rendering
time.
C. Make sure all lights appear in the LightGroup.